# coding=utf-8
"""
Created on 2018年8月9日
"""
from util_base.ufo_decorators import processor
from common_base.cmd import CMD
from processor_base.base_processor import BaseProcessor
from util_base.exception import ParamException, UFOException as E
from common_base.errors import AliveError


@processor(CMD.CMD_OAM_TEST, internal_access=True)
class Test(BaseProcessor):
    """
    test
    """
    
    TAG = 'Test'
    
    def __init__(self, handler):
        """
        Constructor
        """
        BaseProcessor.__init__(self, handler)

    def process(self):
        """
        process protocol
        """
        if self.param1 == 'raise':
            raise E(AliveError.ERROR_TEST)

        return {'status': 'is ok ! ...'}

    def _verify_params(self):
        """
        重写父类方法, 作参数校验
        """
        self.param1 = self.params.get('param1')
        if not self.param1:
            raise ParamException('param1')
